package com.echronos.payment.commons.cpcn.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 中金消息策略
 *
 * @Author wangyadong
 * @Date 2023/9/14 10:27
 * @ClassName ReceiveNoticeEnums
 */
@Getter
@AllArgsConstructor
public enum ReceiveNoticeEnums {
    CPCN_4618("4618", "开户/绑卡结果通知"),
    CPCN_5018("5018", "支付通知"),
    CPCN_5019("5019", "壹企付消息通知"),
    CPCN_5028("5028", "退款结果通知"),
    CPCN_4608("4608", "交易权限开通情况通知"),
    CPCN_7709("7709", "壹企付用户签约成功后台通知"),
    CPCN_5038("5038", "延迟分账通知"),
    CPCN_4658("4658", "提现、充值、代付结果通知"),
    CPCN_5048("5048", "分账回退通知"),
    ;
    private String code;
    private String desc;

    /**
     * 根据code获取枚举信息
     *
     * @param code
     * @return
     */
    public static ReceiveNoticeEnums getByCode(String code) {
        return Arrays.stream(values()).filter(r -> r.getCode().equals(code)).findFirst().orElse(null);
    }
}
